<form class="e-form">
    <input type="hidden" id="id" name="id" value="${object.id}">
    <input type="hidden" name="pId" value="${object.pId}">
    <input type="hidden" name="pCode" value="${object.pCode}">
    <input type="hidden" name="levels" value="${object.levels}">
    <!-- 菜单中默认最顶级为项目名称，id为0，不可修改 -->
    @var isSysPermissions = object.id != '0';

    @if(isSysPermissions){
    <div class="row">
        <div class="col-md-6 col-12">
            <#form:input name="上级菜单" value="${object.pName}" readonly="${isSysPermissions}"/>
        </div>
        <div class="col-md-6 col-12">
            <div class="form-group row">
                <label class="col-4 col-form-label">
                    <span class="required">*</span>
                    菜单类型：
                </label>
                <div class="col-8">
                    <div class="radio-dict" data-dict-type="permissionsType" data-value="${object.type}" data-name="type" data-required="true"></div>
                </div>
            </div>
        </div>
    </div>
    @}

    <div class="row">
        <div class="col-md-6 col-12">
            <#form:input id="name" name="菜单名称" value="${object.name}" required="true"/>
        </div>
        @if(isSysPermissions){
        <div class="col-md-6 col-12">
            <#form:input id="url" name="链接(Href)" value="${object.url}"/>
        </div>
        @}
    </div>
    @if(isSysPermissions){
    <div class="row">
        <div class="col-md-6 col-12">
            <#form:input id="code" name="权限标识" value="${object.code}" tips="controller中定义的权限标识"/>
        </div>
        <div class="col-md-6 col-12">
            <div class="form-group row">
                <label class="col-4 col-form-label">
                    <span class="required">*</span>
                    状态：
                </label>
                <div class="col-8">
                    <div class="radio-dict" data-dict-type="commonStatus" data-value="${object.status}" data-name="status" data-required="true"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6 col-12">
            <div class="form-group row">
                <label class="col-4 col-form-label">
                    图标：
                </label>
                <div class="col-8">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text" id="permissions-icon">
                                ${object.icon}
                            </span>
                        </div>
                        <input type="text" class="form-control" id="icon" name="icon"
                               aria-describedby="permissions-icon" value='${object.icon}'>
                        <div class="input-group-append">
                            <button class="btn btn-secondary btn-icon" type="button" data-toggle="modal" data-target="#icon_modal">
                                <i class="la la-search"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-6 col-12">
            <div class="form-group row">
                <label class="col-form-label col-4" for="isExternalLinks">
                    外链：
                    <i data-toggle="e-tooltip" data-placement="top" data-original-title="是否非项目内地址" class="flaticon-questions-circular-button"></i>
                </label>
                <div class="col-8">
                    <div class="e-checkbox-inline">
                        <label class="e-checkbox">
                            <input id="isExternalLinks" name="isExternalLinks" value="1" type="checkbox"
                                   @if(1 == object.isExternalLinks){
                                       checked
                                   @}
                            > 是
                            <span></span>
                        </label>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-12">
            <#form:textarea id="tips" name="备注" value="${object.tips}"/>
        </div>
    </div>
    @}

    <div class="row">
        <div class="col text-center">
            @if(isSysPermissions){
                <#btn btnType="success" name="保存" icon="la la-save" click="mPermissionsView.saveData(this)" permission="sys:permissions:save"/>
            @}
            @if(isNotEmpty(object.id)){
                @if(isSysPermissions){
                    <#btn btnType="danger" name="删除" icon="la la-remove" click="mPermissionsView.deletePermission(this)" permission="sys:permissions:delete"/>
                @}

                @if(object.levels < 4){
                    <#btn btnType="info" name="新增下级" icon="la la-plus" click="mPermissionsView.addPermission()" permission="sys:permissions:add"/>
                @}
            @}
        </div>
    </div>
</form>
